﻿#include <iostream>
struct NPC {
    int hp;
    int mp;
    int damage;
};
struct MONSTER {
    int hp;
    int mp;
    int damage;
    int price;
};
struct ROLE {
    int hp;
    int mp;
    int damage;
    int diamond;
};
bool Act(ROLE* acter, ROLE* beater) {
    beater->hp -= acter->damage;
    return beater->hp > 0;
}

class CROLE {

public://将下面的内容公开，使得能直接被访问
    int hp;
    int mp;


    void Init() {//初始化
        hpRecover = 3;
    }

    bool Act(NPC* beater) {
        beater->hp -= damage;
        return beater->hp > 0;
    }

private://将下面的内容私有，只有这个类才能访问
    int hpRecover;

public://下面的内容被公开
    int damage;
    int diamond;
};

int main()
{
    MONSTER atm{ 1000,500,100,6000 };//结构体定义
    ROLE zs{ 1000,1000,50,1000 };
    ROLE ls{ 1000,500,100,6000 };

    CROLE zs1;
    CROLE ls1;

    zs1.Init();
    ls1.Init();

    Act(&zs, &ls);
    std::cout << ls.hp;
}

